package com.xy.improve;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/6/10 19:21
 * @description
 */
public class HouseDirector {
    private HouseBuilder houseBuilder = null;

    /**
     * 构造器传入
     * @param houseBuilder
     */
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    /**
     * 建造房屋过程
     * @return
     */
    public House constructHouse() {
        houseBuilder.buildBasic();
        houseBuilder.buildWall();
        houseBuilder.buildRoofed();
        return houseBuilder.house;
    }
}
